source("./code/loadPackages.R")

## Load in the monthly data
monthdata = fread("./data/monthlyData.csv")


# Simple monthly analysis
monthFit1 = glm(newmids_us ~ hawkMain + presHawk, data=monthdata, family=poisson)
summary(monthFit1)

# Monthly analysis with controls
monthFit2 = glm(newmids_us ~ hawkMain + presHawk + 
                war.now + log.last.war.dead.pc + log.months.since.last.war +
                last.war.win + 
                n.mid.us.challenge.past5 + prop.mid.win.us.past5 + is.recession + unigov + 
                cinc + 
                log(tenuremonth), data=monthdata, family=poisson)
summary(monthFit2)

#### Table 5: Effect of NSC Principals' Hawkishness on MIDs, Using Monthly Data ####
stargazer(monthFit1, monthFit2,
          column.sep.width = "0pt", no.space=T, align=T, df=F,
          covariate.labels = c("Advisers' hawkishness", 
                               "President's hawkishness", 
                               "War ongoing",
                               "Deaths per capita in last war (logged)",
                               "Months since last war (logged)",
                               "Victory in last war",
                               "MID challenges to US in last 5 years",
                               "Average MID outcome in last 5 years",
                               "Economic recession",
                               "Unified government",
                               "US material capabilities",
                               "President's tenure (logged months)",
                               "Constant"))